package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;


import java.util.Map;

/**
 * @ author     ：廖传港
 * @ date       ：Created in 2020/12/26 20:50
 * @ description：商品詳情頁面渲染
 * @ modified By：
 * @ ersion:
 */
@Controller
public class ItemController {

    @Autowired
    private ItemFeignClient itemFeignClient;

    //进入商品详情页面儿
    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable Long skuId,Model model) {
        Map map = itemFeignClient.getItem(skuId);
        model.addAllAttributes(map);
        return "item/index";
    }
}
